package com.yuanfeng.order.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yuanfeng.order.dto.GoodsParaDTO;
import com.yuanfeng.order.dto.ShopParaDTO;
import com.yuanfeng.order.entity.OrderGoodsEvaluationEntity;
import com.yuanfeng.order.vo.CommentsEntityVO;
import com.yuanfeng.order.vo.GoodsCommentsVO;
import com.yuanfeng.order.vo.ShopCommentsVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Map;

/**
 * @ClassName OrderGoodsEvaluationMapper
 * @Description  商品评论表
 * @Author cyp
 * @Date 2023-05-26 13:28:35
 * @Version 1.0
 **/
@Mapper
public interface OrderGoodsEvaluationMapper extends BaseMapper<OrderGoodsEvaluationEntity> {

     /**
      *  查询评论总数
      * @param commonId
      * @return
      */
     Integer queryCommentsCount(Integer commonId);


    /**
     * 查询评论
     * @param page
     * @param map
     * @return
     */
    IPage<CommentsEntityVO> commentsQuery(IPage<CommentsEntityVO> page,@Param("map")Map<String, Object> map);

    /**
     * 根据条件查询评论
     * @param commonId
     * @param evaluation
     * @return
     */
    Integer getEvaluationTotalCount(@Param("commonId") Integer commonId, @Param("evaluation") String evaluation);

    /**
     * 注释按商品插入
     *
     * @param mapGoods
     * @return
     */
    boolean commentsInsertByGoods(Map<String, Object> mapGoods);

    /**
     * 平台查询评论
     */
    IPage<GoodsCommentsVO> selectGoodsComments(IPage<GoodsCommentsVO> page,@Param("param") GoodsParaDTO goodsPara);

    /**
     * 店铺动态评价
     */
    IPage<ShopCommentsVO> selectShopComments(IPage<ShopCommentsVO> page,@Param("param") ShopParaDTO shopPara);

    /**
     * 删除店铺动态评价
     */
    void deleteShopComments(@Param("map")Map<String,String> map);

    /**
     * 商家回复
     * @param map
     * @return
     */
    boolean updateForReply(@Param("param") Map<String, Object> map);

    /**
     * 商家回复追加评论
     * @param map
     * @return
     */
    boolean updateForAdditionalReply(@Param("param")  Map<String, Object> map);

}
